/****************************************************************
 * Fulguro
 * Copyright (C) 2004 Christophe Clienti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 ***************************************************************/

#include <flgrCoreMalloc.h>
#include <flgrCoreVector.h>
#include <flgrMeasureBase.h>
#include "flgrmeasure_ext.h"


FLGR_Vector **flgr1d_measure_min_max_1(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
  FLGR_Vector **array = (FLGR_Vector **) flgr_malloc(2*sizeof(FLGR_Vector*));

  array[0] = mini;
  array[1] = maxi;

  flgr1d_measure_min_max(dat, mini, maxi);

  return array;
}

FLGR_Vector **flgr2d_measure_min_max_1(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
  FLGR_Vector **array = (FLGR_Vector **) flgr_malloc(2*sizeof(FLGR_Vector*));

  array[0] = mini;
  array[1] = maxi;

  flgr2d_measure_min_max(dat, mini, maxi);

  return array;
}

FLGR_Vector *flgr1d_measure_volume_1(FLGR_Data1D *dat, FLGR_Vector *volume) {
  flgr1d_measure_volume(dat, volume);
  return volume;
}

FLGR_Vector *flgr2d_measure_volume_1(FLGR_Data2D *dat, FLGR_Vector *volume) {
  flgr2d_measure_volume(dat, volume);
  return volume;
}

FLGR_Vector *flgr1d_measure_expected_value_1(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
  flgr1d_measure_expected_value(dat, expected_value);
  return expected_value;
}





FLGR_Vector **flgr1d_measure_min_max_2(FLGR_Data1D *dat) {
  FLGR_Vector **array = (FLGR_Vector **) flgr_malloc(2*sizeof(FLGR_Vector*));

  array[0] = flgr_vector_create(dat->spp,dat->type);
  array[1] = flgr_vector_create(dat->spp,dat->type);

  flgr1d_measure_min_max(dat, array[0], array[1]);

  return array;
}

FLGR_Vector **flgr2d_measure_min_max_2(FLGR_Data2D *dat) {
  FLGR_Vector **array = (FLGR_Vector **) flgr_malloc(sizeof(FLGR_Vector*) * 2);

  array[0] = flgr_vector_create(dat->spp,dat->type);
  array[1] = flgr_vector_create(dat->spp,dat->type);

  flgr2d_measure_min_max(dat, array[0], array[1]);

  return array;
}

FLGR_Vector *flgr1d_measure_volume_2(FLGR_Data1D *dat, FLGR_Type type) {
  FLGR_Vector *vec = flgr_vector_create(dat->spp,type);

  flgr1d_measure_volume(dat, vec);

  return vec;
}

FLGR_Vector *flgr2d_measure_volume_2(FLGR_Data2D *dat, FLGR_Type type) {
  FLGR_Vector *vec = flgr_vector_create(dat->spp,type);

  flgr2d_measure_volume(dat, vec);

  return vec;
}

FLGR_Vector *flgr1d_measure_expected_value_2(FLGR_Data1D *dat, FLGR_Type type) {
  FLGR_Vector *vec = flgr_vector_create(dat->spp,type);

  flgr1d_measure_expected_value(dat, vec);

  return vec;
}

